package cn.zktr.Personnel.controllers.zhouxiong;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import cn.zktr.Personnel.model.service.zhouxiong.*;

@Controller
public class QinJiaController {

	@Autowired
	private JiChuService jichu;
	@Autowired
	private QiTaYeWuService yw;
	
	@RequestMapping("zx/qin-jia")
	public void zhujiemian() {}
	
	/**请假种类
	 * @param page
	 * @param rows
	 * @return
	 */
	@RequestMapping("QinJiaZhongLei")
	@ResponseBody
	public Map<String,Object> qinjia(int page,int rows) {
		Map<String,Object> map = new HashMap<>();
		map.put("total",jichu.seleQinJiaZhongLei().size());
		Page<Object> p=PageHelper.startPage(page,rows);
		JSONArray findAll=jichu.seleQinJiaZhongLei();
		//页内容
		map.put("rows",findAll);
		return map;
	}
	
	/**请假列表
	 * @param page
	 * @param rows
	 * @return
	 */
	@RequestMapping("QinJiaLieBiao")
	@ResponseBody
	public Map<String,Object> qinjialiebiao(int page,int rows) {
		Map<String,Object> map = new HashMap<>();
		Page<Object> p=PageHelper.startPage(page,rows);
		JSONArray findAll=yw.seleQinJia();
		//页内容
		map.put("total",findAll.size());
		map.put("rows",findAll);
		return map;
	}
	
	/**请假 统计
	 * @param page
	 * @param rows
	 * @return
	 */
	@RequestMapping("QinJiaTongJi")
	@ResponseBody
	public Map<String,Object> qinjialiebiaos(Integer empid,int page,int rows) {
		Map<String,Object> map = new HashMap<>();
		//页内容
		map.put("total",yw.seleQinJiaQB().size());
		Page<Object> p=PageHelper.startPage(page,rows);
		JSONArray findAll=yw.seleQinJiaQB();
		map.put("rows",findAll);
		return map;
	}
	
	@RequestMapping("updateQJ")
	@ResponseBody
	public String updateQJ(Integer EMPID,Integer TYPEID,String LAEMINTIME,String LAEMAXTIME,String LAEREM) {
		String jieguo = yw.updateQJ(EMPID, TYPEID, LAEMINTIME, LAEMAXTIME, LAEREM);
		return jieguo;
	}
	
}
